package com.im.server.enterprise.manage.controller;

import java.util.List;

import javax.annotation.Resource;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller;

import com.im.base.common.task.QueueTaskThread;
import com.im.base.common.util.KeyUtil;
import com.im.server.enterprise.business.push.NoticePush;
import com.im.server.general.common.bean.TextNotice;
import com.im.server.general.common.service.TextNoticeService;
import com.only.common.result.ResultMessage;
import com.only.general.annotation.action.ActionMapping;
import com.only.general.annotation.action.MethodMapping;
import com.only.general.annotation.parameter.Define;

@Controller
@ActionMapping("notice")
public class NoticeController {
	
	protected final Logger logger = LogManager.getLogger(this.getClass());

	@Resource
	NoticePush noticePush;
	@Resource
	QueueTaskThread queueTaskThread;
	@Resource
	TextNoticeService textNoticeService;
	
	@MethodMapping("pushTextNotice")
	public Object pushTextNotice( 
			@Define("textNotice") TextNotice textNotice,
			@Define("userIds") List<String> userIds,
			@Define("pushType") String pushType) {
		ResultMessage message = new ResultMessage();
		String key=KeyUtil.getKey();
		textNoticeService.save(textNotice, userIds, pushType);
		noticePush.pushTextNotice(key, textNotice, userIds, pushType);;
		return message;
	}
}
